﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Collections;
using GPCSC.Web;
using NickLee.Common;
using System.Text;

namespace GPCSC.Web.sjs
{
    public partial class XQTB : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                byte[] userInfo = (byte[])base.o_baseTable[c_obj.s_userInfo];
                Hashtable userInfoTable = CompressData.UnCompressHashtable(userInfo);
                Model.CL_USER_S users = (Model.CL_USER_S)userInfoTable["SYS_USER"];
                this.Label1.Text = users.POSTName.ToString();
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Hashtable htable = f_getElements(base.o_uiTable);
            SQLServerDAL.databyhtable dtable = new SQLServerDAL.databyhtable();
            dtable.databyhtables(htable, "add", "sjhz", "", "");
            byte[] userInfo = (byte[])base.o_baseTable[c_obj.s_userInfo];
            Hashtable userInfoTable = CompressData.UnCompressHashtable(userInfo);
            Model.CL_USER_S users = (Model.CL_USER_S)userInfoTable["SYS_USER"];
            this.Response.Write("<script>alert('"+users.CL_ROLEname.ToString()+DateTime.Now.Year.ToString()+"年"+DateTime.Now.Month.ToString()+"月数据上报成功！');window.location.href='../sjsbyes/ZTJ.aspx';</script>");
        }
        public Hashtable f_getElements(Hashtable o_uiTable)
        {
            //UIFactory Get Values as Hashtable:界面工厂获取值，并保存在哈希表
            base.o_uiTable.Clear();
            base.o_uiTable = UIFactory.UIFactory_Get(this);
            base.o_uiTable.Add("year",DateTime.Now.Year.ToString());
            base.o_uiTable.Add("moth", DateTime.Now.Month.ToString());
            byte[] userInfo = (byte[])base.o_baseTable[c_obj.s_userInfo];
            Hashtable userInfoTable = CompressData.UnCompressHashtable(userInfo);
            Model.CL_USER_S users = (Model.CL_USER_S)userInfoTable["SYS_USER"];
            base.o_uiTable.Add("postid", users.CL_POSTID_PK.ToString());
            return base.o_uiTable;

        }
    }
}